import os,shutil

from PIL import Image

def size_judge(image_path):
    with Image.open(image_path) as img:
        width, height = img.size
        if width<2000:
            return False
        else:
            return True   

dir="Z:/系统/1-设计画好图/"
dir2="D:/Desk/pattern/原生/"
tag={'success':0,'fail':0,'size-wrong':0,'ever':0,'type':0}
    
items=os.listdir(dir)
for item in items:
    if os.path.isdir(dir+item):
        files=os.listdir(dir+item)
        for file in files:
            if file.lower().endswith(('.png')):                
                if not os.path.exists(dir2+item+'|%|'+file):
                    if size_judge(dir+item+'/'+file):
                        try:
                            shutil.copy(dir+item+'/'+file,dir2+item+'|%|'+file)
                            tag['success']+=1
                        except:
                            tag['fail']+=1
                    else:
                        tag['size-wrong']+=1
                else:
                    tag['ever']+=1
            else:
                tag['type']+=1
            print('#')
                    
print("移动数据：")
print(tag)